﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Linq;

namespace Hp.Vertica.Migration.SqlServer.Test
{
    [TestClass]
    public class DatabaseTest
    {
        [TestMethod]
        public void DataSource()
        {
            ServerInstance ds = new ServerInstance("16.186.76.37", "sa", "sa1qaz!QAZ");

            Database db = ds.Databases.SingleOrDefault(c => c.Name == "master");
            Assert.IsTrue(ds.Databases.Contains(db));
            ds.Refresh();
            Assert.IsTrue(ds.Databases.Contains(db));
            Database db2 = ds.Databases.SingleOrDefault(c => c.Name == "master");
            Assert.AreEqual(db, db2);
        }

        [TestMethod]
        public void SchemaCollection()
        {
            ServerInstance ds = new ServerInstance("16.186.76.37", "sa", "sa1qaz!QAZ");
            Database db = ds.Databases.SingleOrDefault(c => c.Name == "master");
            Assert.IsTrue(db.SchemaCollection.Schemas.Count > 0);
        }
    }
}
